package com.h3c.ptability.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.h3c.ptability.mapper.PtEsignDocFeatureMapper;
import com.h3c.ptability.entity.PtEsignDocFeature;
import com.h3c.ptability.service.IPtEsignDocFeatureService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 模板的特征定义表实现类
 *
 * @author chenyifan
 * @since 2022-05-19 17:13:41
 */
@Service
public class PtEsignDocFeatureServiceImpl extends ServiceImpl<PtEsignDocFeatureMapper, PtEsignDocFeature> implements IPtEsignDocFeatureService {

    @Override
    public Map<String,List<PtEsignDocFeature>> getPtEsignDocFeatureList(List<String> templateIdList) {
        HashMap<String, List<PtEsignDocFeature>> result = new HashMap<>();
        for (String templateId : templateIdList) {
            result.put(templateId,list(new QueryWrapper<PtEsignDocFeature>().lambda()
                    .eq(PtEsignDocFeature::getTemplateId, templateId)
            ));
        }
        return result;
    }

    @Override
    public List<PtEsignDocFeature> getOrgTemplateFeatureList(String templateId) {
        return list(new QueryWrapper<PtEsignDocFeature>().lambda()
                .eq(PtEsignDocFeature::getTemplateId, templateId)
                .isNotNull(PtEsignDocFeature::getOrgInfoName)
        );
    }
}

